package org.neptune.service.rabbit;

import org.neptune.api.entity.SeckillLog;
import org.neptune.common.constant.NeptuneConstant;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author lwl
 * @date 2019/7/17 17:32
 */
@Component
public class LogProducer {

	private static final Logger logger = LoggerFactory.getLogger(LogProducer.class);

	@Autowired
	private AmqpTemplate amqpTemplate;

	public void sender(SeckillLog seckillLog) {

		logger.info("producer : seckilllog goodsId :{},userId : {}", seckillLog.getSeckillId(),
				seckillLog.getUserId());

		amqpTemplate.convertAndSend(NeptuneConstant.LOG_QUEUE_NAME, seckillLog);
	}
}
